<?php
  include_once("connect.php");
  function mailing($val){
  
$result=mysql_query("SELECT * FROM `ap3_sp_rdv` WHERE ID=".$val);
$a=mysql_fetch_assoc($result);
$date=$a['dateRDV'];
$heure=$a['heure'];
$client=$a['client'];

$result=mysql_query("SELECT * FROM `ap3_sp_utilisateur` WHERE ID=".$client);
$a=mysql_fetch_assoc($result);

 mail($a['mail'], "validation de votre rendez vous chez l'esthéticienne", 
 "votre rendez vous du".$date." à ".$heure." vien d'etre validée \n bonne journée \n\n\n le salon ");
  
  }




 if ( isset($_POST['suppr']))
 {
 foreach ($_POST['suppr'] as $val)
    mysql_query("DELETE FROM `ap3_sp_rdv` WHERE `ap3_sp_rdv`.`ID` =".$val.";");
 }
 
 
 if ( isset($_POST['valide']))
 {

 foreach ($_POST['valide'] as $val){
    mysql_query("UPDATE `ap3_sp_rdv` SET `valide` = 'valide' WHERE `ap3_sp_rdv`.`ID` =".$val.";");
    
  // mailing($val);

 }
 }
 
  header ("location: .?page=".$_POST['page']);






?>